﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using TCC.CMFlow.Models.Enumerators;

namespace TCC.CMFlow.Models
{
    public class Workflow
    {
        public int ID { get; set; }

        public int CategoriaWorkflowID { get; set; }

        public int Status { get; set; }

        [Display(Name="Data de emissão")]
        public DateTime DataEmissao { get; set; }

        public virtual CategoriaWorkflow CategoriaWorkflow { get; set; }

        public virtual ICollection<WorkflowDado> Dados { get; set; }

        public virtual ICollection<WorkflowAprovacao> Aprovacoes { get; set; }

        [Display(Name = "Status")]
        public virtual string DescricaoStatus
        {
            get
            {
                switch (this.Status)
                {
                    case (int)EnumStatusWorkflow.Gerado:
                        return EnumStatusWorkflow.Gerado.ToString();
                    case (int)EnumStatusWorkflow.Pendente:
                        return EnumStatusWorkflow.Pendente.ToString();
                    case (int)EnumStatusWorkflow.Aprovado:
                        return EnumStatusWorkflow.Aprovado.ToString();
                    case (int)EnumStatusWorkflow.Reprovado:
                        return EnumStatusWorkflow.Reprovado.ToString();
                    case (int)EnumStatusWorkflow.Cancelado:
                        return EnumStatusWorkflow.Cancelado.ToString();
                    case (int)EnumStatusWorkflow.Reprocessamento:
                        return EnumStatusWorkflow.Reprocessamento.ToString();
                    case (int)EnumStatusWorkflow.Reprocessado:
                        return EnumStatusWorkflow.Reprocessado.ToString();
                    default:
                        return string.Empty;
                }
            }
        }
    }
}